package com.sunni.反射;

import com.sunni.反射.entity.Person;

public class _01_三种获取类的方式 {
    public static void main(String[] args) throws Exception {

        // 1.Class.forName("全类名")
        Class Per1 = Class.forName("com.sunni.反射.entity.Person");
        System.out.println("Per1= " + Per1);

        // 2. 类名.class
        Class Per2 = Person.class;
        System.out.println("Per2= " + Per2);

        // 3. 对象名.class
        Person person = new Person();
        Class Per3 = person.getClass();
        System.out.println("Per3= " + Per3);

        System.out.println("---比较---");

        System.out.println("Per1 == Per2: " + (Per1 == Per2));
        System.out.println("Per1 == Per3: " + (Per1 == Per3));
    }
}
